/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.opgea.token.domain.entities;

import java.io.Serializable;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 * 
 * @author Ramesh
 */
@Entity
@Table(name = "currenttoken")
@XmlRootElement
@NamedQueries({
	@NamedQuery(name = "CurrentToken.findAll", query = "SELECT c FROM CurrentToken c"),
	@NamedQuery(name = "CurrentToken.findById", query = "SELECT c FROM CurrentToken c WHERE c.id = :id") })
public class CurrentToken implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Long id;
    @JoinColumn(name = "token_id", referencedColumnName = "id")
    @ManyToOne
    private Token token;
    @JoinColumn(name = "company_id", referencedColumnName = "id")
    @ManyToOne
    private Company company;

    public CurrentToken() {
    }

    public CurrentToken(Long id) {
	this.id = id;
    }

    public Long getId() {
	return id;
    }

    public void setId(Long id) {
	this.id = id;
    }

    public Token getToken() {
	return token;
    }

    public void setToken(Token tokenId) {
	this.token = tokenId;
    }

    public Company getCompany() {
	return company;
    }

    public void setCompany(Company company) {
	this.company = company;
    }

    @Override
    public int hashCode() {
	int hash = 0;
	hash += (id != null ? id.hashCode() : 0);
	return hash;
    }

    @Override
    public boolean equals(Object object) {
	if (!(object instanceof CurrentToken)) {
	    return false;
	}
	CurrentToken other = (CurrentToken) object;
	if ((this.id == null && other.id != null)
		|| (this.id != null && !this.id.equals(other.id))) {
	    return false;
	}
	return true;
    }

    @Override
    public String toString() {
	return "com.opgea.qms.domain.entities.generated.CurrentToken[ id=" + id
		+ " ]";
    }

}
